export default {
  namespaced: true,
  state: () => ({
    title: "hello a",
  }),
  getters: {
    ga1: () => 100,
    ga2: () => 200,
  },
  mutations: {
    SET_TITLE: (state, value = "") => (state.title = value),
  },
  actions: {
    add(store, obj) {
      console.log(obj.a + obj.b);
    },
  },
  modules: {
    a1: {
      namespaced: true,
      state: () => ({
        title: "hello a1",
        num: 100,
      }),
      getters: {
        ga3: (state, getters, rootState) => 300 + rootState.num2,
        ga4: () => 400,
      },
      mutations: {
        SET_TITLE: (state, value = "") => (state.title = value),
      },
      actions: {
        add(store, obj) {
          console.log(
            obj.a +
              obj.b +
              store.state.num +
              store.getters.ga3 +
              store.rootState.num1 +
              store.rootGetters.g1 +
              store.rootGetters.g2
          );
        },
      },
    },
    a2: {},
  },
};
